Rust wrapper for Apple's Grand Central Dispatch (GCD).
GCD is an implementation of task parallelism that allows tasks to be submitted to queues where they are scheduled to execute.
For more information, see Apple's Grand Central Dispatch reference.
- Documentation: http://ssheldon.github.io/rust-objc/dispatch/
- Crate: https://crates.io/crates/dispatch
Serial Queues
Serial queues execute tasks serially in FIFO order. The application's main
queue is serial and can be accessed through the Queue::main
function.
use ;
let queue = create;
queue.async;
queue.async;
Concurrent Queues
Concurrent dispatch queues execute tasks concurrently. GCD provides global
concurrent queues that can be accessed through the Queue::global
function.
Queue
has two methods that can simplify processing data in parallel, foreach
and map
:
use ;
let queue = global;
let mut nums = vec!;
queue.foreach;
assert!;
let nums = queue.map;
assert!;